<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <title>博客列表</title>
    <link rel="icon" th:href="@{../img/title.png}" type="image/ico">
    <meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
    <meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
    <meta name="author" content="yinqi">
    <link th:href="@{/admin/css/bootstrap.min.css}" rel="stylesheet">
    <link th:href="@{/admin/css/materialdesignicons.min.css}" rel="stylesheet">
    <link th:href="@{/admin/css/style.min.css}" rel="stylesheet">

    <!--    弹窗-->
    <script th:src="@{/admin/js/admin/bloglist.js}"></script>
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
</head>

<body>
<div class="container-fluid p-t-15">

    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-toolbar clearfix">

                    <div class="toolbar-btn-action">
                        <a class="btn btn-primary m-r-5" th:href="@{/admin/page/addBlog}"><i class="mdi mdi-plus"></i>
                            新增</a>
                        <a class="btn btn-success m-r-5" th:onclick="alertBlogAhthen(1)"><i class="mdi mdi-check"></i>
                            启用</a>
                        <a class="btn btn-warning m-r-5" th:onclick="alertBlogAhthen(0)"><i class="mdi mdi-block-helper"></i>
                            禁用</a>
                        <a class="btn btn-danger" href="#!" th:onclick="deleteBlogById()"><i
                                class="mdi mdi-window-close"></i> 删除</a>
                        <a class="btn btn-pink" href="#!" th:onclick="history.go()"><i
                                class="mdi mdi-rotate-3d"></i> 刷新</a>
                    </div>
                </div>
                <div class="card-body">

                    <div class="table-responsive">
                        <table class="table table-bordered">
                            <thead>
                            <tr>
                                <th>
                                    <label class="lyear-checkbox checkbox-primary">
                                        <input type="checkbox" id="check-all"><span></span>
                                    </label>
                                </th>
                                <th>编号</th>
                                <th>标题</th>
                                <th>关键字</th>
                                <th>博客种类</th>
                                <th>编写时间</th>
                                <th>状态</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody id="tbody">

                            <tr th:each="blog : ${blogs}">
                                <td>
                                    <label class="lyear-checkbox checkbox-primary">
                                        <input type="checkbox" name="ids[]" th:value="${blog.id}"><span></span>
                                    </label>
                                </td>
                                <td th:text="${blog.id}"></td>
                                <td th:text="${blog.title}"></td>
                                <td th:text="${blog.keyWord}"></td>
                                <td th:text="${blog.blogType.typeName}"></td>
                                <td class="edit_time" th:text="${blog.createTime}"></td>
                                <td class="edit_time" th:if="${blog.status}==1" style="color: #15c377">启用</td>
                                <td class="edit_time" th:if="${blog.status}==0" style="color: red">禁用</td>
                                <td>
                                    <div class="btn-group">
                                        <a class="btn btn-xs btn-default" th:href="@{/admin/getBlog/}+${blog.id}" title="编辑" data-toggle="tooltip"><i
                                                class="mdi mdi-pencil"></i></a>
                                        <a class="btn btn-xs btn-default" title="查看" onclick="Sorry()" data-toggle="tooltip"><i
                                                class="mdi mdi-eye"></i></a>
                                        <button class="btn btn-xs btn-default" th:onclick="deleteBlog([[${blog.id}]])"
                                                title="删除" data-toggle="tooltip"><i
                                                class="mdi mdi-window-close"></i></button>
                                    </div>
                                </td>
                            </tr>


                            </tbody>
                        </table>
                    </div>
                    <ul class="pagination">
                        <li class="active">
                            第[[${pageNum}]]页共[[${pageCount}]]页
                            <a th:if="${pageNum>=1}" style="background-color: #33cabb;border: none;color: white;"
                               th:href="@{/admin/page/BlogList/}+(${pageNum}-1)">
                                上一页
                            </a>
                            <a th:if="${pageNum}<=${pageCount}" style="background-color: #33cabb;border: none;color: white;"
                               th:href="@{/admin/page/BlogList/}+(${pageNum}+1)">
                                下一页
                            </a>
                        </li>
                    </ul>

                </div>
            </div>
        </div>

    </div>

</div>

<script type="text/javascript" th:src="@{/admin/js/jquery.min.js}"></script>
<script type="text/javascript" th:src="@{/admin/js/bootstrap.min.js}"></script>
<script type="text/javascript" th:src="@{/admin/js/main.min.js}"></script>
<script type="text/javascript">
    $(function () {
        $('.search-bar .dropdown-menu a').click(function () {
            var field = $(this).data('field') || '';
            $('#search-field').val(field);
            $('#search-btn').html($(this).text() + ' <span class="caret"></span>');
        });
    });
</script>
</body>
</html>